package org.ekstrabilet.stadium.logic;

import org.ekstrabilet.game.beans.Game;
import org.ekstrabilet.logic.exceptions.StadiumException;
import org.ekstrabilet.stadium.beans.Row;
import org.ekstrabilet.stadium.beans.Seat;
import org.ekstrabilet.stadium.beans.Sector;
import org.ekstrabilet.stadium.beans.Stadium;
import org.ekstrabilet.stadium.beans.Tribune;
import org.ekstrabilet.ticket.beans.Ticket;
import org.ekstrabilet.ticket.logic.TicketLogic;

public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Stadium stadium= new Stadium();
		stadium.setCapacity(800);
		stadium.setCity("Krakow");
		stadium.setName("xxxxx");
		Tribune[] tribune= new Tribune[4];
		tribune[0]= createTribune(1);
		tribune[1]= createTribune(2);
		tribune[2]= createTribune(3);
		tribune[3]= createTribune(4);
		stadium.setTribunes(tribune);
		StadiumLogic logic= StadiumLogic.getInstance();
		try {
			logic.addStadium(stadium);
		} catch (StadiumException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		/*
		Ticket ticket= new Ticket();
		ticket.setGameId(1);
		ticket.setRow(2);
		ticket.setSeat(3);
		ticket.setSector("A");
		ticket.setStadium(stadium);
		ticket.setTribune(2);
		ticket.setUserId(1);
		TicketLogic ticketLogic= TicketLogic.getInstance();
		ticketLogic.addTicket(ticket);
		//logic.findSectorIdBy_SN_SC_TN_ST("xxxxx", "Krakow", 2, "A");
		 * 
		 */
	}
	
	private static Tribune createTribune(int num){
		Tribune tribune= new Tribune();
		Sector sector= new Sector();
		for(int i=0; i<7; i++){
			Row row= new Row();
			for(int j=0; j<10; j++){
				Seat seat= new Seat();
				row.addSeat(seat);
			}
			sector.addRow(row);
		}
		sector.setSign('A');
		tribune.addSector(sector);
		
		sector= new Sector();
		for(int i=0; i<7; i++){
			Row row= new Row();
			for(int j=0; j<10; j++){
				Seat seat= new Seat();
				row.addSeat(seat);
			}
			sector.addRow(row);
		}
		sector.setSign('B');
		tribune.addSector(sector);
		tribune.setNumber(num);
		tribune.setCapacity(140);
		return tribune;

	}

}
